package rocket;

import com.alibaba.rocketmq.client.producer.DefaultMQProducer;
import com.alibaba.rocketmq.client.producer.SendResult;
import com.alibaba.rocketmq.common.message.Message;

import java.nio.charset.StandardCharsets;

/**
 * @author wsz
 * @date 2022/2/22 18:14
 **/
public class Producer {

    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("producer_grp_wsz");
        producer.setNamesrvAddr("192.168.174.138:9876");
        producer.start();

        Message message = new Message("tp_demo1", "hello rocketmq".getBytes(StandardCharsets.UTF_8));
        SendResult send = producer.send(message);

        System.out.println(send);
        producer.shutdown();
    }
}
